package com.jx.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jx.service.OrderService;
import com.jx.servicrimpl.OrderServiceImpl;
/**
 * 删除订单
 * @author 鄢泽然
 *
 */
public class DeleteOrderController extends HttpServlet {
	OrderService os = new OrderServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String []id = req.getParameterValues("oid");
		if(id.length!=0){
		for (int i = 0; i < id.length; i++) {
			os.deleteOrder(Integer.parseInt(id[i]));
		}
		
		PrintWriter pw = resp.getWriter();
		pw.write("1");
		pw.flush();
		pw.close();
	}
		}
}
